package org.igeek.config.initAndDestroy;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @package org.igeek.config.initAndDestroy
 * @Description
 * @Author LittlePunk [296526219@qq.ccom]
 * @Version 2022.1
 * @Date 2023/11/14 16:28
 */
public class MainTest {
    public static void main(String[] args) {
        //无参构造
        //afterPropertiesSet 初始化
        AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(MyConfig.class);
        System.out.println("---------------IOC容器创建成功----------------");
        Cat cat = ac.getBean("cat", Cat.class);
        //cat = Cat{name = 加菲猫}
        System.out.println("cat = " + cat);
        //destroy 销毁
        ac.close();
    }
}
